/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gitbox;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Maulnick
 */
public class CopyingFile {
    FileReader fr = null;
    BufferedReader br = null;

    FileWriter fw = null;
    BufferedWriter bw = null;

    FileInputStream fis = null;
    FileOutputStream fos = null;
    File xx =null;
    File yy = null;
    public CopyingFile(){
        try {
            System.out.println("IN");
//            fr = new FileReader("M:\\Kuliah\\Semester6\\Progin\\Tugas\\5_SOCKETPROGRAMMING\\workdir\\text1.txt");
//            br = new BufferedReader(fr);
//
//            fw = new FileWriter("M:\\Kuliah\\Semester6\\Progin\\Tugas\\5_SOCKETPROGRAMMING\\workdir\\text2.txt");
//            bw = new BufferedWriter(fw);
//            String temp = br.readLine();
//            while(temp!=null){
//                System.out.println(temp);
//                bw.write(temp);
//                //bw.newLine();
//                temp=br.readLine();
//            }
//            br.close();
//            try {
//                if (bw != null) {
//                    bw.flush();
//                    bw.close();
//                }
//            } catch (IOException ex) {
//                ex.printStackTrace();
//            }
//            System.out.println("JPG_ " + br);
            xx = new File("M:\\Kuliah\\Semester6\\Progin\\Tugas\\5_SOCKETPROGRAMMING\\workdir\\music.flv");
            yy = new File("M:\\Kuliah\\Semester6\\Progin\\Tugas\\5_SOCKETPROGRAMMING\\workdir\\music3.flv");
            fis = new FileInputStream(xx);
            fos = new FileOutputStream(yy);
            int ch;
            StringBuffer strContent = new StringBuffer("");
            while((ch = fis.read()) != -1){
                strContent.append((char)ch);
                fos.write(ch);
            }
            fis.close();
            fos.close();
        } catch (IOException ex) {
            Logger.getLogger(CopyingFile.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    public static void main(String args[]){
        CopyingFile cf = new CopyingFile();
    }
}
